import cupy as cp
import numpy as np
import time
from scipy.ndimage import zoom
import torch
import torch.nn.functional as F
# 1. 安装 cuda
# 2. pip install numpy cupy-cuda12x
# 3. pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

# 使用示例
if __name__ == "__main__":


    input_tensor = torch.rand(10, 3, 72,512, 512).cuda()  # 在 GPU 上

    # 插值倍数 (1.0, 2.0, 2.0, 2.0) 意味着高度和宽度分别缩放 2 倍
    output_tensor = F.interpolate(input_tensor, scale_factor=(2.0,2.0, 2.0), mode='trilinear', align_corners=False)

    # 输出调整后的尺寸
    print(output_tensor.shape)